<template>
    <div>
        <div class="topBtn">
            <div class="sizeBig"><span>系统日志</span></div>
            <div>
                
            </div>
        </div>
        <div class="message">
            <p class="character">有别于业务操作日志，系统日志记录的是用户在系统的所有基础操作和系统报错数据的存档。而业务日志记录的是详细的业务处理操作，业务日志更针对性，做业务分析时数据调取速度也是更快 <span class="skip">查看帮助文档</span></p>
        </div>
        <div class="inputcontent">
            <el-input v-model="search" placeholder="请输入内容" class="inSearch" @keydown.native.enter="init"></el-input>
            <div class="iconSearch"></div>
        </div>
        <div class="tablesize">
            <Table :reset="reset"></Table>
        </div>
        <div class="block">
            <el-pagination
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :current-page="currentPage"
                :page-sizes="[10,20,50,100]"
                :page-size="size"
                layout="total, sizes, prev, pager, next, jumper"
                :total="TotalNum">
            </el-pagination>
        </div>
    </div>
</template>

<script>
import {getData} from '@/api/journal'
import Table from './components/journalTable'
import operation from '@/mixins/operation'
import {delay} from '@/utils/autoSearch'
export default {
    name:'journal',
    mixins:[operation],
    components:{
        Table
    },
    data(){
        return{
            module:'journal',    //online数据请求
            search:'',   //搜索条件
            reset:[],
            currentPage:1,
            size:10,
            TotalNum:0,
        }
    },
    // watch: {
    //     //用来监听页面变量的改变
    //     //监听搜索，300ms执行一次fetchData方法（去搜索）
    //     search() {
    //         delay(() => {
    //             this.fetchData();
    //         }, 300);
    //     }
    // },
    methods:{
        // 自动搜索的方法
        async fetchData(val){
            this.init({keyName:this.search})
        },
        handleSizeChange(size){
            this.size = size
            this.init()
        },
        handleCurrentChange(val){
            this.currentPage = val
            this.init()
            // let page=val
            // this.init({keyName:this.search,userStatu:-1,page:this.currentPage,pageSize:10})
        },
        init(){
            getData({keyName:this.search,page:this.currentPage,pageSize:this.size}).then(res=>{
                if(parseInt(res.Code)===1){
                    this.reset = res.Result.Items
                    this.TotalNum = res.Result.TotalNum
                }
            })
        }
    },
    created(){
        this.init()
    }
}
</script>

<style lang="scss" scoped>
.sizeBig{
    font-size: 16px;
}
.topBtn{
    height: 60px;
    width: 98%;
    margin: 0 auto;
    line-height: 60px;
    display: flex;
    justify-content: space-between;
}
.message{
    width:98%;
    margin: 0 auto;
    height:60px;
    background:rgba(255,255,255,1);
    border:1px solid rgba(238,238,238,1);
    font-size:14px;
    .character{
        margin: 20px 0 21px 20px;
        color:#999999;
        .skip{
            color: #0095FF;
            margin-left:10px;
            cursor:pointer; 
        }
    }
}
.inputcontent{
    width:98%;
    margin: 0 auto;
    height: 80px;
    position: relative;
    padding-top:21px;
    box-sizing: border-box; 
    .iconSearch{
        position: absolute;
        left: 277px;
        top:30px;
        width:20px;
        height: 20px;
        background-image: url('./image/搜索.png') ;
        background-repeat: no-repeat;
        cursor:pointer; 
    }
    .inSearch{
        width:308px;
        height:40px;
    }
}
.tablesize{
    width:98%;
    margin: 0 auto;
}
.block{
    text-align: right;
    margin:28px 20px 0 0; 
}
</style>
